/**
 * 侧边栏菜单
 */
import tem from './index.html'
import $_fn from '~plugins'
class navtopCtrl {
  constructor($scope,$rootScope,$location,$state) {
      $scope.curUrl = $location.path()
      var LocalMenu = $rootScope.Menu || $_fn.getLocal('menu')
      var _url = $scope.curUrl.split('/')
      var menu = LocalMenu.find(li => li.state === _url[1])
  	  $scope.isOpen = false
      console.log('ryy:', menu, _url)
      $scope.menu = menu
      $scope.openMenu = function(){
           $scope.isOpen = !$scope.isOpen
           if(!$scope.isOpen){
               $('.public-bgBotBtn div').removeClass('mar-fixed')
           }
           else {
               $('.public-bgBotBtn div').addClass('mar-fixed')
           }
      }
      $scope.isActive = function(cur){
          if($scope.curUrl.indexOf(cur) < 0){
              return false
          }else{
              return true
          }
      }
      $scope.subGoview = function(url,path){
          $rootScope._curUrl = path
          $state.go(_url[1]+'.'+url,{},{reload:true})
      }
  }
}


navtopCtrl.$inject = ['$scope','$rootScope','$location','$state','$interval']
module.exports = angular.module('directive.sideMenu', []).directive('sideMenu', function() {
    return {
        template: tem,
        replace:true,
        controller: navtopCtrl,
        link:function(scope){
           
        }
    }
}).name